<?php

namespace App\Http\Controllers;

use App\Modules\Advertisement\Model\AdModel;
// use App\Modules\Manage\Model\ConfigModel;
// use App\Modules\Manage\Model\LinkModel;
// use App\Modules\Manage\Model\NavModel;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;

use Theme;

class BasicController extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;

    public $theme;
    public $themeName;
    public $breadcrumb;

    public function __construct()
    {
        $this->themeName = 'default';
        $this->theme = $this->initTheme();
        // $siteConfig = ConfigModel::getConfigByType('site');
        // $this->theme->set('site_config',$siteConfig);
        // $this->theme->set('site_index_logo', $siteConfig['site_logo_1']);
        // $basisConfig = ConfigModel::getConfigByType('basis');
        // $this->theme->set('basis_config',$basisConfig);
        // $navList = NavModel::getNavList();
        // if(!empty($navList) && is_array($navList->toArray())){
        //     $this->theme->set('nav_list',$navList);
        // }
        // $friend_link = LinkModel::getFriendLink();
        // $this->theme->set('friend_link', $friend_link);
        // $banners = AdModel::getAdByCode('HOME_TOP_SLIDE');
        // $this->theme->setBanners($banners);

        $banners = AdModel::getOpenAd();
        $this->theme->set('banners',$banners);

    }

    public function initTheme($layout = 'default')
    {
        return Theme::uses($this->themeName)->layout($layout);
    }
}
